<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('渠道代理商提现列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 100px;">流水号：</label>
                            <input type="text" name="businessNo"/>
                        </li>
                        <li>
                            <label style="width: 100px;">交易状态：</label>
                            <select name="status" th:with="type=${@dict.getType('ls_channel_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>渠道选择：</label>
                            <select name="channelCode" class="form-control m-b"
                                    th:with="type=${@dict.getType('channel_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 100px;">操作类型：</label>
                            <select name="operationType">
                                <option value="">所有</option>
                                <option value="1">代理商提现</option>
                                <option value="2">代付转账</option>
                            </select>
                        </li>
                        <li>
                            <label style="width: 10px;"></label>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="add()" shiro:hasPermission="channel:payment:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="channel:payment:edit">-->
            <!--                    <i class="fa fa-edit"></i> 修改-->
            <!--                </a>-->
            <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="channel:payment:remove">-->
            <!--                    <i class="fa fa-remove"></i> 删除-->
            <!--                </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="channel:payment:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" class="table text-nowrap"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('channel:payment:edit')}]];
    var removeFlag = [[${@permission.hasPermi('channel:payment:remove')}]];
    var statusDatas = [[${@dict.getType('ls_channel_status')}]];
    var bankAccountTypeDatas = [[${@dict.getType('ls_bank_account_type')}]];
    var accAountTypeDatas = [[${@dict.getType('ls_account_type')}]];
    var lsTransferMode = [[${@dict.getType('ls_transfer_mode')}]];
    var channelType = [[${@dict.getType('channel_type')}]];
    var prefix = ctx + "channel/payment";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "渠道代理商提现",
            firstLoad: false,
            clickToSelect: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'channelCode',
                    title: '渠道',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(channelType, value);
                    }
                },
                {
                    field: 'agentName',
                    title: '代理名称'
                },
                {
                    field: 'businessNo',
                    title: '业务流水号'
                },
                {
                    field: 'fixFeeFlag',
                    title: '固定提现费'
                },
                {
                    field: 'applyAgentId',
                    title: '提现代理商'
                },

                {
                    field: 'agentId',
                    title: '直属代理商'
                },
                {
                    field: 'bankAccountType',
                    title: '账号类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(bankAccountTypeDatas, value);
                    }
                },
                {
                    field: 'accountType',
                    title: '账户类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(accAountTypeDatas, value);
                    }
                },
                {
                    field: 'operationType',
                    title: '操作类型',
                    formatter: function (value) {
                        switch (value) {
                            case '1':  return '<span style="color: green;">代理商提现</span>';
                            case '2':   return '<span style="color: green;">代付转账</span>';
                            default: return '-';
                        }
                    }
                },
                {
                    field: 'transferMode',
                    title: '代付转账场景',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(lsTransferMode, value);
                    }
                },
                {
                    field: 'applyAmount',
                    title: '提现金额'
                },
                {
                    field: 'invoiceType',
                    title: '扣税模式',
                    visible: false
                },
                {
                    field: 'status',
                    title: '交易状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'createtime',
                    title: '添加时间'
                },
                {
                    field: 'updatetime',
                    title: '完成时间'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.status !== 1) {
                            // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="queryWithdraw(\'' + row.id + '\')"><i class="fa fa-upload"></i>查询</a>');
                        }

                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /* 上送渠道 */
    function queryWithdraw(id) {
        $.modal.confirm("确认发送渠道查询吗？", function () {
            $.operate.post(prefix + "/queryWithdraw", {"id": id});
        })
    }

    function add() {
        $.modal.openFull("添加渠道代理商提现", prefix + "/add");
    }
</script>
</body>
</html>